import http from '@/util/request.js'

export default {
    // 根据id获取秒杀订单信息
    getSeckillOrderById: (id) => {
        return http({
            url: `/api/seckill/order/id/${id}`,
            method: 'get'
        })
    },

    // 根据用户id获取秒杀订单信息
    getSeckillOrderByUserId: (userId) => {
        return http({
            url: `/api/seckill/order/userid/${userId}`,
            method: 'get'
        })
    },

    // 添加秒杀订单
    addSeckillOrder: (data) => {
        return http({
            url: '/api/seckill/order/add',
            method: 'post',
            data
        })
    },

    // 更新秒杀订单
    updateSeckillOrder: (data) => {
        return http({
            url: '/api/seckill/order/update',
            method: 'put',
            data
        })
    },

    // 删除秒杀订单(软删除)
    deleteSeckillOrder: (id) => {
        return http({
            url: `/api/seckill/order/delete/${id}`,
            method: 'delete'
        })
    },

    // 获取秒杀订单列表
    getSeckillOrderList: (data) => {
        return http({
            url: '/api/seckill/order/list',
            method: 'get',
            params: data
        })
    },

    // 获取秒杀订单分页列表
    getSeckillOrderPage: (current, size, data) => {
        return http({
            url: '/api/seckill/order/page',
            method: 'get',
            params: {
                current: current,
                size: size,
                ...data
            }
        })
    }
}
